export function checkLogin() {
    const tokenvalue = window.localStorage.getItem('token');
    if (tokenvalue == null) {
      alert("请先登录");
      window.location.href = "/api/login";
    }
    return tokenvalue;
}

export function logout(){
  // 清除 localStorage 中的 token
  window.localStorage.removeItem('token');
   
  // 跳转到登录页面
  window.location.href = "/api/login";
}